package com.liuhe.test1;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexTest1 {
    public static void main(String[] args) {
        String str = "java,,,,,java8,,,,,,,,,,,JAVA17......Java11";
        //获取正则对象
//        String regex = "(?i)java(?:8|11|17)"; //包含数字
        String regex = "(?i)java(?=8|11|17)";  //查找时需要,不返回
        Pattern p = Pattern.compile(regex);
        //通过m的规则在str中查找
        Matcher m = p.matcher(str);
        while(m.find()){
            String r = m.group();
            System.out.println(r);
        }

    }
}
